import {
	mapMutations
} from 'vuex'
export default {
	...mapMutations([
		'upUserInfo'
	]),
	leftClick(){
			this.$refs.popup.show({message:"从上往下滑动"});
	},
	changeItem(index){
		this.current = index
	},
	getUserInfo() {
		let that = this
		that.$httpRequest.get({
			that: that,
			url: 'wechat/getUserInfo',
			params: {
				id:that.id
			},
			success: res => {
				if (res.code === that.$httpConfig.SUCCESS_CODE) {
					that.userData = res.data
				
				} else {
					
				}
			}
		})
	},
	getPageList() {
		let that = this
		that.$httpRequest.get({
			that: that,
			url: 'wechat/getUserInformationList',
			params: {
				pageNo: that.page,
				pageSize: that.list_rows,
				userId: that.id
			},
			success: res => {
				that.loading = false
				if (res.code === that.$httpConfig.SUCCESS_CODE) {
					console.log(res.data)
					if (that.page === 1) {
						that.list = res.data.rows
					} else {
						that.list = that.list.concat(res.data.rows)
					}
					that.page++
				} else {
					
				}
			}
		})
	},
	//关注
	follow(id) {
		let that = this
		that.$httpRequest.request({
			that: that,
			url: 'wechat/follow',
			params: {
				followUserId:id
			},
			success: res => {
				if (res.code === that.$httpConfig.SUCCESS_CODE) {
					that.userData.follow = true
					 
				}
			}
		})
	},
	unfollow(id) {
		let that = this
		that.$toast.confirm({
			content: '确定取消关注？',
			confirmText: '确定',
			callback: result => {
				if (result) {
					that.$httpRequest.request({
						that: that,
						url: 'wechat/unfollow',
						params: {
							followUserId:id
						},
						success: res => {
							if (res.code === that.$httpConfig.SUCCESS_CODE) {
								that.userData.follow = false
				 
							}
						}
					})
				}else{
					
				}
			}
		})
	},




}
